/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uca.sisbec.actions.reportes;

import com.uca.sisbec.commons.HibernateAction;
import com.uca.sisbec.forms.reportes.ReporteBecGraduadosForm;
import com.uca.sisbec.helpers.manto.CarreraHelper;
import com.uca.sisbec.helpers.manto.UniversidadHelper;
import com.uca.sisbec.helpers.reportes.ReporteBecGraduadosHelper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author Alex
 */
public class ReporteBecGraduadosAction extends HibernateAction {
    
    public ActionForward init(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        UniversidadHelper uh = new UniversidadHelper(getSession(request));
        request.setAttribute("universidadList", uh.getAllUniversidades());
        
        CarreraHelper ch = new CarreraHelper(getSession(request));
        request.setAttribute("carrerasList", ch.ObtenerTodasCarreras());
        
        return mapping.findForward("success");
    }
    
    public ActionForward ConstruirReporteBecGraduados(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        ReporteBecGraduadosForm rbgf = (ReporteBecGraduadosForm) form;
        
        ReporteBecGraduadosHelper rbgh = new ReporteBecGraduadosHelper(getSession(request));
        request.setAttribute("reporte", rbgh.ConstruirReporteBecGraduadosDB(rbgf));
        
        UniversidadHelper uh = new UniversidadHelper(getSession(request));
        request.setAttribute("universidadList", uh.getAllUniversidades());
        
        CarreraHelper ch = new CarreraHelper(getSession(request));
        request.setAttribute("carrerasList", ch.ObtenerTodasCarreras());
        
        return mapping.findForward("success");
    }
    
    
}
